#include <vector>

#ifndef LOCAL_MAX_H_
#define LOCAL_MAX_H_

/** Used to sort data according to its absolute value and refer to its original index in the Data vector.

A collection of TIdxAndData is sorted according to its data value (if values are equal, according
to indices). The index allows access back to the vertex in the Data vector.
*/
struct LocalMax
{
	//LocalMax() :Idx(-1), Data(0){}

	bool operator<(const LocalMax& other) const
	{
		if (Data < other.Data) return false;
		if (Data > other.Data) return true;
		return (Idx < other.Idx);
	}

	///The index of the vertex within the Data vector. 
	int Idx;

	///Vertex data value from the original Data vector sent as an argument to RunPersistence.
	double Data;
};

void findLocalMax(const double* signal, unsigned int signalSize, std::vector<LocalMax>& out, float tresh, unsigned int padding);

#endif